package context

import "github.com/gin-gonic/gin"

const (
	TraceID = "FM_TRACE_ID"
)

func GetTradeID(ctx *gin.Context) string {
	data, ok := ctx.Get(TraceID)
	if !ok {
		return ""
	}
	return data.(string)
}

func SetTradeID(ctx *gin.Context, traceID string) {
	ctx.Set(TraceID, traceID)
	ctx.Writer.Header().Set("trace", traceID)
}
